import request from '@/utils/request'

// 查询工作流列表
export function listWorkflow(query) {
  return request({
    url: '/system/workflow/list',
    method: 'get',
    params: query
  })
}

// 查询工作流详细
export function getWorkflow(id) {
  return request({
    url: '/system/workflow/' + id,
    method: 'get'
  })
}

// 新增工作流
export function addWorkflow(data) {
  return request({
    url: '/system/workflow',
    method: 'post',
    data: data
  })
}

// 修改工作流
export function updateWorkflow(data) {
  return request({
    url: '/system/workflow',
    method: 'put',
    data: data
  })
}

// 删除工作流
export function delWorkflow(id) {
  return request({
    url: '/system/workflow/' + id,
    method: 'delete'
  })
}

// 批量删除工作流
export function delWorkflowBatch(ids) {
  return request({
    url: '/system/workflow/' + ids,
    method: 'delete'
  })
}

// 获取工作流设计数据
export function getWorkflowDesign(id) {
  return request({
    url: '/system/workflow/design/' + id,
    method: 'get'
  })
}

// 保存工作流设计
export function saveWorkflowDesign(data) {
  return request({
    url: '/system/workflow/saveDesign',
    method: 'post',
    data: data
  })
}

// 执行工作流
export function executeWorkflow(id, inputParams) {
  return request({
    url: '/system/workflow/execute/' + id,
    method: 'post',
    data: inputParams
  })
}

// 查询工作流执行实例列表
export function listWorkflowInstance(query) {
  return request({
    url: '/system/workflow/instance/list',
    method: 'get',
    params: query
  })
}

// 获取工作流执行实例详细
export function getWorkflowInstance(id) {
  return request({
    url: '/system/workflow/instance/' + id,
    method: 'get'
  })
}

// 删除工作流执行实例
export function delWorkflowInstance(id) {
  return request({
    url: '/system/workflow/instance/' + id,
    method: 'delete'
  })
}

// 批量删除工作流执行实例
export function delWorkflowInstanceBatch(ids) {
  return request({
    url: '/system/workflow/instance/' + ids,
    method: 'delete'
  })
}

// 导入工作流
export function importWorkflow(data) {
  return request({
    url: '/system/workflow/import',
    method: 'post',
    data: data
  })
}

// 导出工作流
export function exportWorkflow(id) {
  return request({
    url: '/system/workflow/export/' + id,
    method: 'get'
  })
}

// 获取工作流统计信息
export function getWorkflowStatistics() {
  return request({
    url: '/system/workflow/statistics',
    method: 'get'
  })
} 